<!--- 新增模态框 -->
<div class="row" style="overflow:hidden;" id="Modals-add" style="/*display: none;*/">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf">
            <div class="widget-head am-cf">
                <div class="widget-title am-fl">新增权限</div>
                <div class="widget-function am-fr">
                    <a href="javascript:;" class="am-icon-cog"></a>
                </div>
            </div>
            <div class="widget-body am-fr">

                <form class="am-form tpl-form-border-form tpl-form-border-br" id="Modals-form">
                    <div class="am-form-group">
                        <label for="user-name" class="am-u-sm-3 am-form-label">权限描述 <span
                                class="tpl-form-line-small-title">Name</span></label>
                        <div class="am-u-sm-9">
                            <input type="text" class="tpl-form-input" id="user-name" placeholder="请输入新增权限描述"
                                   name="access">
                            <small>建议3个字符以上。</small>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label for="user-name" class="am-u-sm-3 am-form-label">模块 <span
                                class="tpl-form-line-small-title">Module</span></label>
                        <div class="am-u-sm-9">
                            <input type="text" class="tpl-form-input" id="user-name" placeholder="请输入、、、"
                                   name="module">
                            <small>。。。</small>
                        </div>
                    </div>



                    <div class="am-form-group">
                        <div class="am-u-sm-9 am-u-sm-push-3">
                            <button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success "
                                    id="access-add-submit" url="{:url('admin/access/save')}">提交
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>

    $(function () {

        //提交新增操作
        $('#access-add-submit').click(function () {
            var info = $('#Modals-form').serialize();
            // console.log(info);
            //return ;

            $.ajax({
                type: 'post',
                data: info,
                url: $('#access-add-submit').attr('url'),
                success: function (data) {
                    // console.log(data);
                    if(confirm(data+'\n点击【确定】将刷新页面\n点击【取消】将留在此页')){
                            location = location;
                        }
                },
                error: function () {
                    toastr.error("出现错误，请重试");
                }
            });
        });
    });

</script>